import 'package:OASys/entity/MenuVo.dart';
import 'package:OASys/httpConfig/EntityFactory.dart';

class RoleVo {
  int id;
  String name;
  int status;
  String statusName;
  List<MenuVo> menuList;

  RoleVo({
    this.id,
    this.name,
    this.status,
    this.statusName,
    this.menuList,
  });

  RoleVo.fromJson(Map<String, dynamic> json) {
    List<MenuVo> menuVoList = new List<MenuVo>();
    if (json['menuList'] != null) {
      (json['menuList'] as List).forEach((v) {
        menuVoList.add(EntityFactory.generateOBJ<MenuVo>(v));
      });
    }
    id = json['id'];
    name = json['name'];
    status = json['status'];
    statusName = json['statusName'];
    menuList = menuVoList;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    List<Map<String, dynamic>> menuList = new List<Map<String, dynamic>>();
    if (this.menuList != null) {
      if (this.menuList.length > 0) {
        this.menuList.forEach((element) {
          menuList.add(element.toJson());
        });
      }
    }
    data['id'] = this.id;
    data['name'] = this.name;
    data['status'] = this.status;
    data['statusName'] = this.statusName;
    data['menuList'] = menuList;
    return data;
  }
}
